﻿/**********************************************************
 ●项目：Smartkernel
 ●公司：智能核心信息技术研发中心
 ●作者：曹艳白
 ●邮箱：caoyanbai@gmail.com
 ●创建：2008-08-10
**********************************************************/
using System;
using System.Security.Principal;

namespace Smartkernel.Security.Authentication
{
    /// <summary>
    /// 标识对象
    /// </summary>
    [Serializable]
    public partial class SmartIdentity : IIdentity
    {
        /// <summary>
        /// 验证类型，这里返回的是自定义的SmartKernelFrameworkAuthentication验证类型
        /// </summary>
        public string AuthenticationType
        {
            get { return "SmartkernelFrameworkAuthentication"; }
        }
        /// <summary>
        /// 是否已经通过验证，如果此对象已存在，则通过了验证
        /// </summary>
        public bool IsAuthenticated
        {
            get { return true; }
        }
        /// <summary>
        /// 用户名，用户的惟一标识
        /// </summary>
        public string Name
        {
            get { return this.ticket.Name; }
        }
        private SmartAuthenticationTicket ticket;
        /// <summary>
        /// 验证票证属性
        /// </summary>
        public SmartAuthenticationTicket Ticket
        {
            get { return this.ticket; }
        }
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="ticket">验证票证</param>
        public SmartIdentity(SmartAuthenticationTicket ticket)
        {
            this.ticket = ticket;
        }
    }
}
